﻿using System;
using System.Collections.Generic;

namespace Pixels.Logic.Structures
{
    public class NuclearReactor : Structure
    {
        internal override string getName() {
            return "Nuclear Reactor";
        }

        internal override void calculateEffects() {
            
        }

        internal override void executeTurn() {
            base.executeTurn();            
            var assigned = AssignedColonists.Count;            
            var explosionChances = new[] { 0, 15, 10, 8, 5, 0 }; // percent chance to explode
            var chance = explosionChances[assigned];
            if (Ur.Random.QuickRnd.d100 < chance) {
                gameplayEffect.addEvent(new GameplayEvents.NuclearReactorExploded(this));
            }
            gameplayEffect.colonyResourceDelta.changeResource(Resource.Power, GlobalConsts.NUCLEAR_REACTOR_POWER_OUTPUT);
        }

        protected override bool isColonistTypeAssignable(Colonist.Occupation occupation) {
            return occupation == Colonist.Occupation.technician;
        }

        internal override int maxSlots() {
            return 4;
        }

    }
}
